/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.util.connectin;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Blasius
 */
public class dbKoneksi {

    private static Connection conn;

    public static Connection getConnection() {
        try {
            DriverManager.registerDriver(new com.mysql.jdbc.Driver());
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/surat", "root", "");
            return conn;
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "Koneksi Gagal. Coba kembali", "Peringatan", JOptionPane.ERROR_MESSAGE);
            Logger.getLogger(dbKoneksi.class.getName()).log(Level.SEVERE, null, ex);
            return conn;
        }
    }
}
